<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>创建报价单</title>
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <script>
        
        $(document).ready(function(){
        $("p>select").select2();
    
    });
    
   
   
    
    <!-- 保存创建/编辑信息 -->
    function saveForm(){
    	$("#activity_pane").showLoading();
    	$("select").removeAttr("disabled");
    	$("#hiddenSelect select").attr("disabled",true);
		$("textarea").removeAttr("disabled");
    	var params = $("#inputForm").serialize();
    	$.post("${ctx}/accounting/voucher/save",params,function(result){
    		/* 弹出提示框,刷新父页面,关闭当前页面 */
    		tipParent(result);
    		 window.parent.frames[0].searchListForm();
    		closeWin();
    		$("#activity_pane").hideLoading();
    	},'json');
    	
    }
    //编辑画面
    function editVoucher() {
		window.location.href="${ctx}/accounting/voucher/form?voucherId="+$("#voucherId").val();
	}
    //删除凭证
    function deleteVoucher(){
    	if(confirm("确定删除会计凭证吗？")){
    		var params = $("#inputForm").serialize();
    		$.post("${ctx}/accounting/voucher/delete",params,function(result){
    			if (result == "true") {
		    		tipParent("删除成功");
		    		window.parent.frames[0].searchListForm();
		    		closeWin();
				}else{
					tipParent("删除失败");
				}
    		},'json');
    	}
    }
    </script>
   <style type="text/css">
 	/* no  */
    .tab-no{width: 60px}
  	/* 款式图片  */
    .tab-kstp{width: 130px}
    .select_red{background-color: #fbaea8;}
</style>
</head>
<body>
<form id="inputForm">
<!-- 创建编辑头部 -->   
<div id="createHead" class="layerHeader clearfix">
    <!-- 创建 --> 
    <p class="headerTitle">查看会计凭证</p>
    <div class="headerButton clearfix">
        <!-- <button type="button" onclick="editVoucher();">编辑</button> -->
        <button type="button" onclick="deleteVoucher();">删除</button>
        <button type="button" onclick="closeWin()"><spring:message code="purchaseContract_edit_cancle"/></button>
    </div>
</div>
<div id="showHtml" class="tabBoxSm">
<input type="hidden" id="voucherId" name="voucherEntity.voucherId" value="${voucherEntity.voucherId }">
<div class="smOrderBox" id="activity_pane">                          
        <div class="clearfix">               	
            	<div class="items clearfix">        	
                    <div class="col-33 clearfix haveToBox">
	                    <!-- 凭证编号  -->
	                    <p class="tit">凭证编号</p> 
	                    <label>${voucherEntity.voucherNo}</label>
                        <input type="hidden" id="voucherNo" name="voucherEntity.voucherNo" value="${voucherEntity.voucherNo}"/>              
                    </div>
                    <div class="col-33 clearfix">
                    <!-- 日期 -->
                        <p class="tit">日期</p>
	                    <label id="financeNoLabel"><fmt:formatDate value="${voucherEntity.invoiceDate }" pattern="yyyy-MM-dd"/></label>
                    </div>
                    <div class="col-33 clearfix">
                    <!-- 单据 -->
                        <p class="tit">单据</p>
                        <a id="superLink" href="${uploadFile.filePath }${uploadFile.uploadFile }">${uploadFile.uploadFile }</a>
                    </div>
                </div>
                <div class="items clearfix">
                	<!-- 合计金额 -->
                    <p class="tit">合计金额</p> 
                    <label><fmt:formatNumber value="${voucherEntity.totalAmount}" pattern="#,##0.00"/></label>
                </div>
            </div>
            <div class="listBg tabPadding overflowX">
		        <div class="tableArea">
		            <div class="tableScroll" style = "height:470px;width: 947px;overflow: auto;">
		                <table cellpadding="0" class="tableHead" style="z-index: 13;">
		                    <thead>
		                    <tr>
		                        <th><p class="tab-no">操作</p></th>
		                        <th><p class="width-100px">业务期间</p></th>
		                        <th><p class="width-120px">会计科目</p></th>
		                        <th><p class="width-100px">业务类别</p></th>
		                        <th><p class="width-120px">业务号</p></th>
		                        <th><p class="width-100px">货币类别</p></th>
		                        <th><p class="width-100px">借方</p></th>
		                        <th><p class="width-100px">贷方</p></th>
		                        <th><p class="width-120px">摘要</p></th>
		                    </tr>
		                    </thead>
		                </table>
		                <table cellpadding="0" class="tableBody">
		                    <tbody id="listHtml">
		                    <c:forEach items="${voucherDetailList }" var="voucherDetail" varStatus="status">
                    			<tr>
						    		<td><p class="tab-no"></p></td>
						    		<td><p class="width-100px"><fmt:formatDate value="${voucherDetail.financeEntity.financePeriod }" pattern="yyyy-MM"/></p></td>
						    		<td><p class="width-120px">
						    			<select style="width: 120px" disabled="disabled">
					                    	<option value="">请选择</option>
					                    	<c:forEach items="${financeItemList }" var="financeItem">
					                    		<option value="${financeItem.itemCode }"
					                    		<c:if test="${financeItem.itemCode eq voucherDetail.accountItem}">selected="selected"</c:if>
					                    		>${financeItem.itemName }</option>
					                    	</c:forEach>
					                    </select>
						    		</p></td>
						    		<td><p class="width-100px">${fns:getDictName(voucherDetail.financeEntity.financeCategory) }</p></td>
						    		<td><p class="width-120px">${voucherDetail.financeEntity.financeContractNo }</p></td>
						    		<td><p class="width-100px">${fns:getDictName(voucherDetail.financeEntity.financeCurrency) }</p></td>
						    		<td><p class="width-100px"><fmt:formatNumber value="${voucherDetail.debitAmount }" pattern="#,##0.00"/></p></td>
						    		<td><p class="width-100px"><fmt:formatNumber value="${voucherDetail.creditAmount }" pattern="#,##0.00"/></p></td>
						    		<td><p class="width-120px">
										<textarea style="width:120px;background-color: #f1f3f2;" readonly="readonly">${voucherDetail.voucherRemarks }</textarea>
									</p></td>
						    		<input type="hidden" name="voucherDetailEntity.voucherDetailList[${status.index}].settleAccountsId" value="${voucherDetail.settleAccountsId }"/>
						    	</tr>
                    		</c:forEach>
		                    </tbody>
		                </table>
		            </div>
		        </div>
		    </div>
        </div>                 
		    	
</form>
<script>
	window.onload = function(){
			var windowH = window.innerHeight
					||document.documentElement.clientHeight
					||document.body.clientHeight
			$('.tabSm').css({
				'height':windowH - 77,
			});
			$('.tableScrollSm').css({
				'height':windowH - 91
			})
		}
</script>
</body>
</html>
